package com.example.exception;

import com.example.response.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理器
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)//捕获所有异常
    public Result loginEx(Exception exception){
        exception.printStackTrace();
        return Result.error("发生信息异常");
    }
}
